{extend name="public:base" /}

{block name="css"}
<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css"/>
<link href="__ADMIN__/css/style.css" rel="stylesheet">{block name="content"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox ">
                <div class="ibox-content">
                    <div class="box-item">
                        <div class="form-group row"><label class="col-sm-1 col-form-label">订单信息</label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="订单号：{$info.order_sn}" readonly>
                            </div>

                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="总金额：{$info.all_price}" readonly>
                            </div>

                            <style>
                                .zf-box {
                                    display: flex;
                                }

                                .zf-text {
                                    display: flex;
                                    align-items: center;
                                    justify-content: center;
                                    width: 120px;
                                    padding: 7px 0;
                                    border: 1px solid #e5e5e5;
                                }
                            </style>

                            {if $info.status != 1}
                            <div class="col-sm-3">
                                <input type="text" class="form-control" name="pay_price" value="支付金额：{$info.pay_price}" readonly>
                            </div>
                            {else}
                            <div class="col-sm-3">
                                <div class="zf-box">
                                    <span class="zf-text">支付金额：</span>
                                    <input type="number" class="form-control zf-input" name="pay_price" value="{$info.pay_price}">
                                </div>
                            </div>
                            {/if}
                        </div>
                    </div>

                    <div class="box-item">
                        <div class="form-group row">
                            <label class="col-sm-1 col-form-label"></label>

                            <div class="col-sm-3">
                                <input type="text" class="form-control" name="pack_price" value="打包费：{$info.pack_price > 0 ? $info.pack_price : '免打包费'}" readonly>
                            </div>

                            <div class="col-sm-3">
                                <input type="text" class="form-control" name="delivery_price" value="配送费：{$info.delivery_price > 0 ? $info.delivery_price : '免配送费'}" readonly>
                            </div>

                            <div class="col-sm-3">
                                <select class="form-control" disabled>
                                    <!--                                    1订单状态；1：待支付，2：待配送，3：配送中，4：待评价，5：已完成，6：申请退款，7：售后完成，8：已取消',-->
                                    <option value="1" {$info[
                                    'status'] == 1 ? 'selected' : ''}>订单状态：待支付</option>
                                    <option value="2" {$info[
                                    'status'] == 2 ? 'selected' : ''}>订单状态：待配送</option>
                                    <option value="3" {$info[
                                    'status'] == 3 ? 'selected' : ''}>订单状态：配送中</option>
                                    <option value="4" {$info[
                                    'status'] == 4 ? 'selected' : ''}>订单状态：待评价</option>
                                    <option value="5" {$info[
                                    'status'] == 5 ? 'selected' : ''}>订单状态：已完成</option>
                                    <option value="6" {$info[
                                    'status'] == 6 ? 'selected' : ''}>订单状态：申请退款</option>
                                    <option value="7" {$info[
                                    'status'] == 7 ? 'selected' : ''}>订单状态：售后完成</option>
                                    <option value="8" {$info[
                                    'status'] == 8 ? 'selected' : ''}>订单状态：已取消</option>
                                    <option value="9" {$info[
                                    'status'] == 9 ? 'selected' : ''}>订单状态：待自提</option>
                                    <option value="10" {$info[
                                    'status'] == 10 ? 'selected' : ''}>订单状态：待核销</option>
                                </select>
                            </div>
                        </div>
                    </div>

                    <div class="box-item">
                        <div class="form-group row"><label class="col-sm-1 col-form-label"></label>
                            <div class="col-sm-3">
                                <select class="form-control" disabled>
                                    <option value="0" {$info['after_status'] == 0 && $info['after_status'] !='' ? 'selected' : ''}>订单售后状态：未售后</option>
                                    <option value="1" {$info['after_status'] == 1 ? 'selected' : ''}>订单售后状态：售后中</option>
                                    <option value="2" {$info['after_status'] == 2 ? 'selected' : ''}>订单售后状态：售后成功</option>
                                    <option value="3" {$info['after_status'] == 3 ? 'selected' : ''}>订单售后状态：售后失败</option>
                                </select>
                            </div>

                            <div class="col-sm-3">
                                <select class="form-control" disabled>
                                    <option value="0" {$info['is_pay'] == 0 && $info['is_pay'] !='' ? 'selected' : ''}>支付状态：未支付</option>
                                    <option value="1" {$info['is_pay'] == 1 ? 'selected' : ''}>支付状态：已支付</option>
                                </select>
                            </div>

                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="收货时间：{$info.complete_time?timeFormat($info.complete_time):'未收货'}" readonly>
                            </div>
                        </div>
                    </div>

                    <div class="box-item">
                        <div class="form-group row"><label class="col-sm-1 col-form-label"></label>
                            {if $info['is_business'] == 1}
                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="预订用餐时间：{$info.arrive_time}" readonly>
                            </div>
                            {/if}
                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="支付时间：{$info.pay_time?timeFormat($info.pay_time):'未支付'}" readonly>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            {if $info.send_type == 1}
            <div class="ibox ">
                <div class="ibox-content">
                    <div class="box-item">
                        <div class="form-group row"><label class="col-sm-1 col-form-label">收货信息</label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="收货人姓名：{$info.get_username}" readonly>
                            </div>

                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="收货人手机号：{$info.get_mobile}" readonly>
                            </div>
                        </div>
                    </div>

                    <div class="box-item">
                        <div class="form-group row"><label class="col-sm-1 col-form-label"></label>
                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="收货人地址：{$info.get_address}" readonly>
                            </div>

                            <div class="col-sm-3">
                                <input type="text" class="form-control" value="收货地址距离：{$info.distance}" readonly>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                    </div>
                </div>
            </div>
            {/if}

            <div class="ibox ">
                <div class="ibox-content ">
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <th>商品名称</th>
                                <th>商品图片</th>
                                <th>商品属性</th>
                                <th>商品数量</th>
                                <th>单价</th>
                                <th>查看评论</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="order_vice" id="vo"}
                            <tr>
                                <td>{$vo.name}</td>
                                <td><img class="upload-file" src="{:getPicture($vo.img)}"></td>
                                <td>{$vo.suk_name_str}</td>
                                <td>{$vo.count}</td>
                                <td>{$vo.price}</td>
                                <td>
                                    {if condition="$vo['is_comment'] gt 0"}
                                    <a href="{:url('doComment', ['id' => $vo['is_comment'],])}" class="btn btn-white btn-sm">
                                        <i class="iconfont icon-edit"></i> 查看评论
                                    </a>
                                    {else/}
                                    暂未评论
                                    {/if}
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                        {if $info.lottery_coupon_name}
                        <h3 style="margin-top: 40px">使用实物券：<span style="color: red">{$info.lottery_coupon_name}</span>
                        </h3>
                        {/if}
                    </div>
                </div>
            </div>

            <!-- 售后 订单-->
            {if condition="$info.status == 6"}
            <div class="ibox ">
                <div class="ibox-content ">
                    <form method="post">
                        <div class="ibox-content">
                            <div class="box-item">
                                <div class="form-group row"><label class="col-sm-1 col-form-label">售后操作</label>
                                    <div class="col-sm-3">
                                        <select class="form-control changeStatus" name="after_status" {if condition="$info.after_status gt 1" }disabled{/if}>
                                        <option value="0">请选择</option>
                                        <option value="2" {$info[
                                        'after_status'] == 2 ? 'selected' : ''}>成功</option>
                                        <option value="3" {$info[
                                        'after_status'] == 3 ? 'selected' : ''}>失败</option>
                                        </select>
                                    </div>

                                    <div class="col-sm-3">
                                        <input type="text" class="form-control" value="售后原因：{$info.after_reason}" readonly>
                                    </div>
                                </div>
                            </div>

                            <div class="box-item">
                                <div class="form-group row">
                                    <label class="col-sm-1 col-form-label">售后描述</label>
                                    <div class="col-sm-3">
                                        <textarea class="form-control" readonly rows="8">{$info.after_desc}</textarea>
                                        <span class="form-text m-b-none"></span>
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>
                            </div>

                            <div class="box-item after_reason" style="display: none">
                                <div class="form-group row">
                                    <label class="col-sm-1 col-form-label">拒绝原因</label>
                                    <div class="col-sm-3">
                                        <textarea class="form-control" name="after_refuse_reason" {if condition="$info.after_status gt 1" }readonly{/if}
                                        rows="8">{$info.after_refuse_reason}</textarea>
                                        <span class="form-text m-b-none"></span>
                                    </div>
                                </div>
                                <div class="hr-line-dashed"></div>
                            </div>
                        </div>
                        <input type="hidden" name="id" value="{$info.id}"/>

                        <div class="form-group row">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button type="button" class="btn btn-w-m btn-primary ajax-post">
                                    确认审核
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            {/if}
            <button type="button" class="btn btn-w-m btn-default back-page">返回</button>
        </div>
    </div>
    {/block}

    {block name='js'}
    <script src="/static/layui/layui.js"></script>
    <script type="text/javascript" src="__PLUG__/kindeditor/kindeditor-all.js"></script>
    <script type="text/javascript">
        $(".changeStatus").change(function (e) {
            var after_status = $(this).val();
            if (after_status == 3) {
                $(".after_reason").show();
            } else {
                $(".after_reason").hide();
            }
            $(".after_reason").find('textarea').text('');
        })
    </script>
    {/block}